﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Controls="clr-namespace:PSE.Framework.UI.Controls.SmartClient;assembly=PSE.Framework.UI.Controls">

    <!--BEGIN TIMEPICKER-->
    <Style x:Key="ControlTimePickerButtonClock" TargetType="{x:Type Button}">
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Grid Width="19" Height="19">
                        <Rectangle x:Name="Background" Stroke="{x:Null}" RadiusX="1.674" RadiusY="1.674" Margin="0.614,0.452,0.675,0.65" Fill="{DynamicResource BrushTimePickerButtonClockBackground}"/>
                        <Rectangle x:Name="Border" Fill="{x:Null}" Stroke="{DynamicResource BrushTimePickerButtonClockBorder}" RadiusX="2" RadiusY="2"/>
                        <Ellipse x:Name="IconBackgound" Stroke="{x:Null}" Margin="2.492,2.499,2.35,2.343" Fill="{DynamicResource BrushTimePickerButtonClockIconBackground}"/>
                        <Path x:Name="HourPointer" Fill="{x:Null}" Stretch="Fill" Stroke="{DynamicResource BrushTimePickerButtonClockPointerBorder}" StrokeThickness="1.5" Margin="8.597,2.691,8.941,7.84" Data="M9.1890067,10.414452 L10.102397,2.6506374"/>
                        <Path x:Name="MinutePointer" Fill="{x:Null}" Stretch="Fill" Stroke="{DynamicResource BrushTimePickerButtonClockPointerBorder}" Margin="0,6.825,6.695,6.271" Data="M9.1890067,10.414452 L10.102397,2.6506374" StrokeThickness="1.5" HorizontalAlignment="Right" Width="1.384" RenderTransformOrigin="0.5,0.5">
                            <Path.RenderTransform>
                                <TransformGroup>
                                    <ScaleTransform ScaleX="1" ScaleY="1"/>
                                    <SkewTransform AngleX="0" AngleY="0"/>
                                    <RotateTransform Angle="90"/>
                                    <TranslateTransform X="0" Y="0"/>
                                </TransformGroup>
                            </Path.RenderTransform>
                        </Path>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Fill" Value="{DynamicResource BrushTimePickerButtonCalendarBackgroundDisabled}" TargetName="Background"/>
                            <Setter Property="Stroke" Value="{DynamicResource BrushTimePickerButtonCalendarBorderDisabled}" TargetName="Border"/>
                            <Setter Property="Stroke" Value="{DynamicResource BrushTimePickerButtonCalendarIconBackgroundDisabled}" TargetName="IconBackgound"/>
                            <Setter Property="Stroke" Value="{DynamicResource BrushTimePickerButtonCalendarPointerBorderDisabled}" TargetName="HourPointer"/>
                            <Setter Property="Stroke" Value="{DynamicResource BrushTimePickerButtonCalendarPointerBorderDisabled}" TargetName="MinutePointer"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ControlTimePickerListBoxItem" TargetType="ListBoxItem">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ListBoxItem">
                    <Border x:Name="Border" Height="15">
                        <Label x:Name="Label" Content="{Binding .}" FontSize="10" Padding="0" Style="{DynamicResource ControlFont}"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="Background" Value="{DynamicResource BrushTimePickerSelectedItemBackgroundHover}" TargetName="Border"/>
                            <Setter Property="Foreground" Value="{DynamicResource BrushTimePickerWhite}" TargetName="Label"/>
                            <Setter Property="FontSize" Value="11" TargetName="Label"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type Controls:TimePicker}">
        <Setter Property="Padding" Value="1"/>
        <Setter Property="Grid.IsSharedSizeScope" Value="true"/>
        <Setter Property="Height" Value="21"/>
        <Setter Property="Width" Value="100"/>
        <Setter Property="KeyboardNavigation.TabNavigation" Value="Local" />
        <Setter Property="Focusable" Value="False" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls:TimePicker}">
                    <Grid x:Name="grdPrinc" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                        <Border HorizontalAlignment="Stretch">
                            <Grid Grid.IsSharedSizeScope="{TemplateBinding Grid.IsSharedSizeScope}" HorizontalAlignment="Stretch">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition/>
                                    <ColumnDefinition Width="2"/>
                                    <ColumnDefinition Width="20"/>
                                </Grid.ColumnDefinitions>
                                <Controls:TextBox x:Name="Part_txtData" Grid.Column="0" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Top" SnapsToDevicePixels="False"/>
                                <Controls:Button Focusable="False" SnapsToDevicePixels="True" HorizontalAlignment="Right" VerticalAlignment="Top" x:Name="Part_btnAcima" Grid.Column="0" Margin="0,1,3,0" Style="{DynamicResource ControlButtonArrowUp}"/>
                                <Controls:Button Focusable="False" SnapsToDevicePixels="True" HorizontalAlignment="Right" VerticalAlignment="Bottom" x:Name="Part_btnAbaixo" Grid.Column="0" Margin="0,0,3,1" Style="{DynamicResource ControlButtonArrowDown}"/>
                                <Button x:Name="Part_btPopUp" Focusable="False" Grid.Column="2" Style="{DynamicResource ControlTimePickerButtonClock}" HorizontalAlignment="Right"/>
                            </Grid>
                        </Border>
                        <Popup IsOpen="False" AllowsTransparency="False" x:Name="Part_PopUpTime" Placement="Bottom" Width="100" Height="99" StaysOpen="False">
                            <Grid Width="Auto" Background="{DynamicResource BrushTimePickerPopupBackgroundTop}">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" MinWidth="50"/>
                                    <ColumnDefinition Width="Auto" MinWidth="50"/>
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="21" MinHeight="21" MaxHeight="21"/>
                                    <RowDefinition Height="79" MinHeight="79" MaxHeight="79"/>
                                </Grid.RowDefinitions>
                                <Button x:Name="Part_Hour" Grid.Row="0" Grid.Column="0" Background="{x:Null}" Width="Auto" Content="{DynamicResource Infra.Controls.Label.Horas}" BorderBrush="{x:Null}" FontSize="10" Margin="0,0,6.32,0" Style="{DynamicResource ControlFont}"/>
                                <Button x:Name="Part_Minute" Grid.Row="0" Grid.Column="1" Content="{DynamicResource Infra.Controls.Label.Minutos}" Background="{x:Null}" BorderBrush="{x:Null}" FontSize="10" Margin="-6.32,0,0,0" Style="{DynamicResource ControlFont}"/>
                                <Rectangle Stroke="{DynamicResource BrushTimePickerPopupButtonsBorder}" StrokeThickness="1" RadiusX="2" RadiusY="2" Margin="0,0.02,0,0.897" Grid.ColumnSpan="2" Grid.Row="0" VerticalAlignment="Stretch" Fill="{DynamicResource BrushTimePickerPopupButtonsBackground}"/>
                                <Label HorizontalAlignment="Left" Margin="-1.079,-2,0,0" VerticalAlignment="Top" Content="{DynamicResource Infra.Controls.Label.Horas}" Background="{x:Null}" Foreground="{DynamicResource BrushTimePickerPopupButtonForeground}" Style="{DynamicResource ControlFont}" FontSize="11"/>
                                <Label HorizontalAlignment="Stretch" Margin="-0.556,-2,-30.672,0" VerticalAlignment="Top" Content="{DynamicResource Infra.Controls.Label.Minutos}" Background="{x:Null}" Foreground="{DynamicResource BrushTimePickerPopupButtonForeground}" Grid.Column="1" Style="{DynamicResource ControlFont}" FontSize="11"/>
                                <Border BorderThickness="0,0,0,0" BorderBrush="{x:Null}" Grid.Row="1" Grid.ColumnSpan="2" CornerRadius="4,4,4,4" Background="{DynamicResource BrushTimePickerPopupBackgroundBottom}">
                                    <Grid 
											x:Name="Part_TP" 
											ScrollViewer.HorizontalScrollBarVisibility="Hidden" 
											ScrollViewer.VerticalScrollBarVisibility="Hidden" 
											Grid.Row="1" 
											Grid.ColumnSpan="2"
											Grid.Column="1"
											>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition/>
                                            <ColumnDefinition/>
                                        </Grid.ColumnDefinitions>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="*"/>
                                        </Grid.RowDefinitions>
                                        <Rectangle x:Name="Part_Ret" Fill="{x:Null}"/>
                                        <ListBox x:Name="Part_ListHour" ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Hidden" BorderBrush="{x:Null}" Foreground="{DynamicResource BrushTimePickerPopupForeground}" Margin="0,0,0,0" BorderThickness="1,1,1,1" ItemContainerStyle="{DynamicResource ControlTimePickerListBoxItem}"/>
                                        <ListBox x:Name="Part_ListMinute" ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Hidden" BorderBrush="{x:Null}" Foreground="{DynamicResource BrushTimePickerPopupForeground}" BorderThickness="1,1,1,1" ItemContainerStyle="{DynamicResource ControlTimePickerListBoxItem}"/>
                                    </Grid>
                                </Border>
                                <Rectangle Fill="{x:Null}" Stroke="{DynamicResource BrushTimePickerPopupBorder}" StrokeThickness="2" RadiusX="2" RadiusY="2" Margin="0,0,0,0.25" Grid.ColumnSpan="2" Grid.Row="1" Grid.RowSpan="1"/>
                                <Rectangle Stroke="{x:Null}" StrokeThickness="0" Margin="48.852,2.002,-1.049,2.254" Width="Auto" RenderTransformOrigin="0.5,0.5" Grid.Column="0" Grid.Row="1" Grid.RowSpan="1" Fill="{DynamicResource BrushTimePickerPopupSeparatorBackground}">
                                    <Rectangle.RenderTransform>
                                        <TransformGroup>
                                            <ScaleTransform ScaleX="1" ScaleY="1"/>
                                            <SkewTransform AngleX="0" AngleY="0"/>
                                            <RotateTransform Angle="0"/>
                                            <TranslateTransform X="0" Y="0"/>
                                        </TransformGroup>
                                    </Rectangle.RenderTransform>
                                </Rectangle>
                                <Path Stretch="Fill" Stroke="{DynamicResource BrushTimePickerPopupButtonsSeparatorBorder}" StrokeThickness="1" HorizontalAlignment="Left" Margin="-0.491,0.225,0,1.335" Width="1" Data="M47.5,17.666667 L47.5,-0.66666667" Grid.Column="1" Fill="{DynamicResource BrushTimePickerPopupButtonsSeparatorBackground}"/>
                            </Grid>
                        </Popup>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ErrorTemplate">
            <Setter.Value>
                <ControlTemplate>
                    <Grid HorizontalAlignment="Stretch" VerticalAlignment="Top">
                        <Border HorizontalAlignment="Stretch">
                            <Grid Grid.IsSharedSizeScope="{TemplateBinding Grid.IsSharedSizeScope}" HorizontalAlignment="Stretch">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition/>
                                    <ColumnDefinition Width="2"/>
                                    <ColumnDefinition Width="20"/>
                                </Grid.ColumnDefinitions>
                                <Border Grid.Column="0" BorderBrush="{DynamicResource BrushTimePickerBorderError}" BorderThickness="1" CornerRadius="4" HorizontalAlignment="Stretch" Height="{Binding ActualHeight, ElementName=PART_Content}"/>
                                <AdornedElementPlaceholder Grid.Column="0" Grid.ColumnSpan="3" x:Name="PART_Content" VerticalAlignment="Top" HorizontalAlignment="Left"/>
                            </Grid>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ControlDataGridTimePicker" TargetType="{x:Type Controls:TimePicker}" BasedOn="{StaticResource {x:Type Controls:TimePicker}}">
        <Setter Property="Padding" Value="0,0,2,0" />
        <Setter Property="Width" Value="Auto"/>
        <Setter Property="HorizontalAlignment" Value="Stretch"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Border.CornerRadius" Value="0"/>
        <Setter Property="ErrorTemplate">
            <Setter.Value>
                <ControlTemplate>
                    <Grid HorizontalAlignment="Stretch" VerticalAlignment="Top">
                        <Border HorizontalAlignment="Stretch">
                            <Grid Grid.IsSharedSizeScope="{TemplateBinding Grid.IsSharedSizeScope}" HorizontalAlignment="Stretch">
                                <Border Grid.Column="0" BorderBrush="{DynamicResource BrushTimePickerBorderError}" BorderThickness="1" CornerRadius="0" HorizontalAlignment="Stretch" Height="{Binding ActualHeight, ElementName=PART_Content}"/>
                                <AdornedElementPlaceholder Grid.Column="0" Grid.ColumnSpan="3" x:Name="PART_Content" VerticalAlignment="Top" HorizontalAlignment="Left"/>
                            </Grid>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>

    </Style>
    <!--END TIMEPICKER-->
</ResourceDictionary>